package com.drama.api.task;

import cn.hutool.core.util.IdUtil;
import com.drama.api.sys.log.dao.SysLogDao;
import com.drama.api.sys.log.domain.po.SysLogPO;

import java.util.Date;


public class SysLogThread  extends Thread {

    private SysLogDao sysLogDao;
    private String logModule;
    private String logDesc;
    private String userId;
    public SysLogThread(SysLogDao dao,String logModule,String logDesc,String userId)
    {
        this.sysLogDao=dao;
        this.logModule=logModule;
        this.logDesc=logDesc;
        this.userId=userId;
    }

    @Override
    public void run() {
        SysLogPO sysLogPO=new SysLogPO();
        sysLogPO.setId(IdUtil.getSnowflakeNextIdStr());
        sysLogPO.setLogDesc(logDesc);
        sysLogPO.setLogModule(logModule);
        sysLogPO.setCreateBy( userId);
        sysLogPO.setUpdateBy(userId);
        sysLogPO.setCreateDate( new Date());
        sysLogPO.setUpdateDate(sysLogPO.getCreateDate());
        sysLogPO.setDelFlag(Boolean.FALSE);
        sysLogDao.insertSelective(sysLogPO);
    }
}
